package com.sx.gongzhong.pest;

import com.sx.gongzhong.model.HeadParamBean;
import com.sx.gongzhong.model.ReplyUserBean;
import com.sx.gongzhong.net.ApiManager;
import com.sx.gongzhong.net.BaseCallBack;
import com.sx.gongzhong.view.IVoidView;

import java.util.List;
import java.util.Map;

/**添加举报
 * Created by admin on 2018/1/12.
 */

public class AddReportPest {
    private IVoidView iVoidView;

    public AddReportPest(IVoidView iVoidView) {
        this.iVoidView = iVoidView;
    }
    public void addReport(String content, List<String> fileIds) {
        Map<String,Object> map = HeadParamBean.getHead();
        map.put("content",content);
        if (fileIds != null && fileIds.size() > 0){
            for (int i = 0 ; i < fileIds.size() ; i ++){
                map.put("fileIds["+i+"]",fileIds.get(i));
            }
        }
        new ApiManager().addReport(map, new BaseCallBack<ReplyUserBean.BaseResult<Void>>() {
            @Override
            public void onSuccess(ReplyUserBean.BaseResult<Void> response) {
                iVoidView.voidView("提交成功");
            }
            @Override
            public void onFailures(String message) {
                iVoidView.showError(message);
            }
        });
    }
}
